PG_AUTOCTL SHOW URI(1) | pg_auto_failover | PG_AUTOCTL SHOW URI(1) |
pg_autoctl show uri - pg_autoctl show uri
pg_autoctl show uri - Show the postgres uri to use to connect to pg_auto_failover nodes
This command outputs the monitor or the coordinator Postgres URI to use from an application to connect to Postgres:
usage: pg_autoctl show uri [ --pgdata --monitor --formation --json ] --pgdata path to data directory --monitor monitor uri --formation show the coordinator uri of given formation --json output data in the JSON format
Defaults to the value of the environment variable PG_AUTOCTL_MONITOR.
PGDATA
PG_AUTOCTL_MONITOR
XDG_CONFIG_HOME
XDG_DATA_HOME
$ pg_autoctl show uri Type | Name | Connection String -------------+---------+------------------------------- monitor | monitor | postgres://autoctl_node@localhost:5500/pg_auto_failover formation | default | postgres://localhost:5502,localhost:5503,localhost:5501/demo?target_session_attrs=read-write&sslmode=prefer $ pg_autoctl show uri --formation monitor postgres://autoctl_node@localhost:5500/pg_auto_failover $ pg_autoctl show uri --formation default postgres://localhost:5503,localhost:5502,localhost:5501/demo?target_session_attrs=read-write&sslmode=prefer $ pg_autoctl show uri --json [ { "uri": "postgres://autoctl_node@localhost:5500/pg_auto_failover", "name": "monitor", "type": "monitor" }, { "uri": "postgres://localhost:5503,localhost:5502,localhost:5501/demo?target_session_attrs=read-write&sslmode=prefer", "name": "default", "type": "formation" } ]
PostgreSQL since version 10 includes support for multiple hosts in its connection driver libpq, with the special target_session_attrs connection property.
This multi-hosts connection string facility allows applications to keep using the same stable connection string over server-side failovers. That's why pg_autoctl show uri uses that format.
Microsoft
Copyright (c) Microsoft Corporation. All rights reserved.
November 25, 2023 | 2.1 |